package com.as.db.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * @author jcarlos
 * @version 1.0
 * @created 20-may-2010 11:36:27
 */
@Entity
@Table(name="usuarios")
@NamedQueries({
	@NamedQuery(name="usuario.authenticate", query="from Usuario u where u.nameUser = :nameUser and u.password = :password")
})
public class Usuario {

	private Long id;
	private Empleado persona;
	private String nameUser;
	private String password;
	private Boolean habilitado;

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@OneToOne
	@JoinColumn(name="persona_fk_id",nullable=false)
	public Empleado getPersona() {
		return persona;
	}

	public void setPersona(Empleado persona) {
		this.persona = persona;
	}

	public String getNameUser() {
		return nameUser;
	}

	public void setNameUser(String nameUser) {
		this.nameUser = nameUser;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Boolean isHabilitado() {
		return habilitado;
	}

	public void setHabilitado(Boolean habilitado) {
		this.habilitado = habilitado;
	}
}